package com.anycl.spring.soundsystem;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * 默认情况下，@ComponentScan会扫描配置类所在包以及这个包下的所有子包
 */
@Configuration
//@Import(CDConfig.class)
//@ComponentScan(basePackages = {"com.anycl.spring.knights", "com.anycl.spring.soundsystem"})
//@ComponentScan(basePackageClasses = {CDPlayerConfig.class})  // 类所在的包会做为组件扫描的基础包
public class CDPlayerConfig {

    /**
     * JavaConfig方式
     * @return
     */
/*
    @Bean(name = "new")
    public CompactDisc newCD() {
        return new Blue();
    }
*/

/*    @Bean
    public CDPlayer cdPlayer() {
        return new CDPlayer(newCD());
    }*/

    @Bean
    public CDPlayer cdPlayer(CompactDisc compactDisc) {
        return new CDPlayer(compactDisc);
    }
}
